package com.chapter.sample.answer.controller;

import cn.hutool.core.lang.UUID;
import com.chapter.sample.answer.multiplex.batch.CouponBatchService;
import com.chapter.sample.common.utils.UuidUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class CouponController {
    @Resource
    private CouponBatchService couponBatchService;

    @RequestMapping("/coupon/sendv1")
    public void sendv1() {
        log.info("!");
        MDC.put("coupon", UuidUtil.uuid());
        couponBatchService.batchTaskAction();
    }

    @RequestMapping("/coupon/sendv2")
    public void sendv2() {
        couponBatchService.batchTaskActionV2();
    }
}
